package com.example.service_consumer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
public class TestController {
    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/consumer/hello")
    public String hello(){
        String providerBack = restTemplate.getForObject("http://localhost:8081/provider/hello",String.class);
        return "consumer is here." + "get message from" + providerBack;
    }

}
